var ctx=window.daijia.ctx;
var result=window.daijia.result;
var year=window.daijia.year;
var companyId="";
$(document).ready(function(){
	//初始化
	loadData();
});
function loadData(){
	var tr1='<td>销单量</td>';
	var tr2='<td>完成单量</td>';
	var tr3='<td>金额(元)</td>';
	$.ajax({
		
        url : ctx+'/chart/tableOrderMonthData',
        type:'GET',
        async:true,
        dataType : 'json',
        data : {
        
        	"year":$("#year").val(),
        	"companyId":$("#companyId").val()
        },
        success : function(result){
        	var head = "<tr style='font-size:14px;'><th style='width:90px;'>分类\\月份</th><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th><th>10</th><th>11</th><th>12</th></tr>";
        	$("#daijiaHead tr").remove();
        	$("#daijiaHead").append(head);
        	if(result.length>0){
        newcontent+="<tbody style='display:none;'>";		
        		$(result).each(function(index,data){
        		//"<td><a href='"+ctx+"/chart/tableOrderDay?"+"year="+$("#year").val()+"&month="+data.time+"&companyId="+companyId+"' target='_blank'>"+data.time+"</a></td>"+	
	    tr1+="<td>"+data.cancelAmount+"</td>";
	    tr2+="<td>"+data.finishedAmount+"</td>";
	    tr3+="<td>"+data.money+"</td>"
        		});
       newcontent+="</tbody>";		
        	}
        	var newcontent = "<tr>"+tr1+"</tr><tr>"+tr2+"</tr><tr>"+tr3+"</tr>";
        	$('#loadblacklayer').remove();
        	$("#daijiaTable tbody").remove();
        	$("#daijiaTable").append(newcontent);
        	$("#daijiaTable tbody").show(300);
    	}
	});
	
	//return newTotalElements;
}
